<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
<script type="text/javascript">
    function page(n, s) {
        $("#pageNo").val(n);
        $("#pageSize").val(s);
        $("#searchForm").submit();
        return false;
    }
    $(function () {
        $("#all").on('click', function () {
            var isChecked = $(this).prop("checked");
            $("input[name='id']").prop("checked", isChecked);
        })
        $("#conBtn").on('click',function(){
            var ids="";
             var inpIds = $("#contentTable input[name=id]:checked");
             if(inpIds.length==0){
                 toastr.error("请选择确认退费的数据！");
                 return ;
             }
            inpIds.each(function () {
                ids = ids + $(this).val() + ",";
            })
            ids=ids.substring(0,ids.length-1);
//            alert(ids);
            $("#ids").val(ids);//
            $("#submitForm").submit();

        })
    })






</script>
<div class="app">
    <section class="layout">
        <section class="main-content col-lg-12" id="LeftDiv">
            <div class="content-wrap">
                <div class="wrapper" style="bottom: 50px;">
                     <section class="panel panel-default">
                        <div class="panel-body">
                            <div class="table-responsive no-border">
                                <div class="datatable-top">
                                    <div class="pull-left">
                                        <form:form id="searchForm" modelAttribute="inpBillDetail"
                                                   onsubmit="return loadDivForm('mainCenterDiv','searchForm','${ctx}/orders/orders/confirmDrug');"
                                                   method="post" class="form-inline">
                                            <input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
                                            <input id="pageSize" name="pageSize" type="hidden"
                                                   value="${page.pageSize}"/>
                                            <input id="conBtn" class="btn btn-primary" type="button" style="background-color:blue;"
                                                   value="确认"/>
                                        </form:form>
                                        <form:form id="submitForm" modelAttribute="inpBillDetail"
                                                   onsubmit="return formSaveLoad('mainCenterDiv','submitForm','${ctx}/orders/orders/doConfirm','${ctx}/orders/orders/confirmDrug');"
                                                   method="post" class="form-inline">
                                                  <form:hidden path="ids" id="ids"/>
                                         </form:form>
                                    </div>
                                </div>

                                <table id="contentTable" class="table table-bordered mg-t datatable">
                                    <thead>
                                    <tr>
                                        <th><input type=checkbox id="all"></th>
                                        <th>项目名称</th>
                                        <th>项目类别</th>
                                        <th>项目规格</th>
                                        <th>单位</th>
                                        <th>退费数量</th>
                                        <th>单价</th>
                                        <th>退费金额</th>
                                        <th>申请者</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <c:forEach items="${page.list}" var="inpBillDetail" varStatus="ss">
                                        <tr id="${inpBillDetail.id}">
                                            <td>
                                                <input type=checkbox name="id"
                                                       value="${inpBillDetail.id}"></td>
                                            <td> ${inpBillDetail.itemName}</td>
                                            <td> ${inpBillDetail.itemClass=='A'?"药品":"非药品"}</td>
                                            <td> ${inpBillDetail.itemSpec}</td>
                                            <td> ${fns:getDictLabel(inpBillDetail.units, 'SPEC_UNIT', '')}</td>
                                            <td> ${inpBillDetail.amount}</td>
                                            <td> ${inpBillDetail.itemPrice}</td>
                                            <td> ${inpBillDetail.charges}</td>
                                            <td> ${fns:getUserName(inpBillDetail.createBy.id)}</td>
                                        </tr>
                                    </c:forEach>
                                    </tbody>
                                </table>
                                <div class="pagination">${page}</div>
                            </div>
                        </div>
                    </section>
                </div>
            </div>
        </section>
     </section>

</div>

